package cn.jiyun.service.impl;

import cn.jiyun.mapper.FwMapper;
import cn.jiyun.pojo.Ffw;
import cn.jiyun.pojo.Fw;
import cn.jiyun.service.FwService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FwServiceImpl extends ServiceImpl<FwMapper, Fw> implements FwService {
    @Autowired
    private FwMapper fwMapper;

    @Override
    public Page findPage(Integer pageNum, Integer pageSize, Fw fw) {
        Page page=new Page(pageNum,pageSize);
        LambdaQueryWrapper<Fw> qr = new LambdaQueryWrapper<>();
        qr.like(fw.getName()!=null,Fw::getName,fw.getName());
        qr.like(fw.getSex()!=null,Fw::getSex,fw.getSex());
        qr.like(fw.getZjhm()!=null,Fw::getZjhm,fw.getZjhm());
        qr.like(fw.getDz()!=null,Fw::getDz,fw.getDz());
        qr.like(fw.getBdsb()!=null,Fw::getBdsb,fw.getBdsb());
        qr.like(fw.getBh()!=null,Fw::getBh,fw.getBh());
        qr.like(fw.getWid()!=null,Fw::getWid,fw.getWid());
        qr.like(fw.getSid()!=null,Fw::getSid,fw.getSid());
        Page page1=baseMapper.selectPage(page,qr);
        return page1;
    }

    @Override
    public Fw findById(Integer id) {
        return fwMapper.selectById(id);
    }

    /*@Override
    public List<Fw> findAll() {
       return fwMapper.findAll();
    }*/


}
